<div class='fui-page  fui-page-current'>
	<div class='fui-content'>
		<div style="padding:0 0.5rem;">
		<div class="weui_cells weui_cells_form" ng-repeat="item in pagedata.item.adds" style="border-radius: 10px;">
			<div class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary" style="padding:0;padding-bottom:0.3rem">
					<div class="weui_label" style="margin-bottom:0.3rem"><span>广告图片</span><i class="icon icon-cuowu r-f bold" style="color:red" ng-click="pagedata.item.adds.splice($index,1)"></i> </div>
						<ul class="weui_uploader_files" ng-if="item.picurl">
							<li class="weui_uploader_file" style="background-image:url({{tomedia(item.picurl)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							<input class="weui_uploader_input" ng-click="up_file(item,'picurl','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
				</div>
			</div>
			<div class="weui_cell" >
				<div class="weui_cell_hd"><label class="weui_label">广告语</label></div>
				<div class="weui_cell_bd weui_cell_primary">
					<input class="weui_input" type="text" ng-model="item.title" placeholder="输入广告语">
				</div>
			</div>
			<div class="weui_cell weui_cell_select" >
                <div class="weui_cell_hd weui_cell_primary">
                    广告地址
                </div>
                <div class="weui_cell_bd ">
                    <select  ng-model="item.linkurl" class="weui_select" style="padding-right:0.3rem" name="select2">
                        <option ng-selected="item.linkurl==0" value="0">我的圈地址</option>
                        <option ng-selected="item.linkurl==1" value="1">我的店铺地址</option>
                    </select>
                </div>
            </div>
		</div>
		<div class="weui_cells weui_cells_form" style="border-radius: 10px;">
			<div class="weui_cell noborder">
				<div class="weui_cell_bd weui_cell_primary" ng-click="pagedata.item.adds.push({'picurl':'','linkurl':''});">
					+ 新广告
				</div>
			</div>
		</div>
		</div>
		<div class="weui_cells_checkbox" style="margin-top:2rem">
                <div class="fui-cell-label" style="text-align:center;margin:0 auto;padding:0.2rem;font-size:0.56rem">
                    <input type="checkbox" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" style="line-height:0.6rem" ng-checked="pagedata.post.checked==true" ng-model="pagedata.post.checked">
					我已阅读并同意 <a onclick="$('#showsystemcontent').modal();" style="color:#61bba7">《会员协议》</a>
                </div>
        </div>
		<a href='javascript:;' ng-click="post(pagedata.item,'post')" class='btn btn-success block'>确认修改</a>
	</div>
</div>
<div id="showsystemcontent" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:96%;left:2%;top:1.5%;">
	<div class="modal-content" style="min-height:500px">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="right:10px;top:0"><i class="icon jinyunicon icon-wrong" style="color:#ccc;"></i></div>
		<div class="fui-article-page">
				<div class="fui-article-title" style="text-align:center">广告协议</div>
				<div class="fui-article-content" ng-bind-html="trust(pagedata.systemxieyi.systemcontent)"></div>
		</div>
	</div>
	</div>
</div>
<script>
window.scope.location(function(re){
	var pcd = scope.pagedata.item.pcd
	scope.pagedata.lat_lng = re.lat_lng
	if(!pcd || pcd =='' || !pcd.province){
		scope.pagedata.item.pcd.province = re.addressComponents.province
		scope.pagedata.item.pcd.city = re.addressComponents.city
		scope.pagedata.item.pcd.district = re.addressComponents.district
		scope.$evalAsync();
	}
});
scope.pagedata.openLocation=function(){
	wx.openLocation({
		latitude: scope.pagedata.lat_lng.lat, // 纬度，浮点数，范围为90 ~ -90
		longitude: scope.pagedata.lat_lng.lng, // 经度，浮点数，范围为180 ~ -180。
		name: scope.pagedata.item.title, // 位置名
		address: '', // 地址详情说明
		scale: 1, // 地图缩放级别,整形值,范围从1~28。默认为最大
		infoUrl: '', // 在查看位置界面底部显示的超链接,可点击跳转
		success:function(){
			//alert(1111);
		}
	});
}
</script>

<script>
window.scope.sendcode=function(){
	var mobile=window.scope.pagedata.item.mobile;
		if(mobile==null){
		alert('请输入手机号！');
		return false;
	}
	if(mobile.length!=11){
		alert('请输入正确的手机号！');
		return false;
	}
	var d=$('#sms_code').text();
	if(d!='重新获取' && d!='获取验证码'){
		return false;
	}
	window.scope.post({'mobile':mobile},'sendcode','',function(res){
		if(res=='success'){
			setTimeout(function(){countdown(59);},1000);
		}else{
			window.scope.message('验证码发送失败！');
		}
	});
}
function countdown(start){
		if(start>0){
			$('#sms_code').text(start+'后重新发送');
			start=start-1;
			setTimeout(function(){countdown(start);},1000);
		}else{
			
			$('#sms_code').text('重新获取');
		}
	}
</script>
